<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/Typescript/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/Typescript/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/Typescript/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/Typescript/images/logo.svg" color="#222">

<link rel="stylesheet" href="/Typescript/css/main.css">


<link rel="stylesheet" href="/Typescript/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/Typescript/","scheme":"Muse","version":"7.7.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="类型变换 类型推断 Tyepscript可以根据一些简单的规则推断变量的类型  从右到左  变量的类型可以从定义中推断  123&#x2F;&#x2F; 即使不写类型，也会自动推导出来let name &#x3D; &#39;hchlq&#39;;  &#x2F;&#x2F; name是string类型let age &#x3D; 18; &#x2F;&#x2F; age是number类型  从底部流出  返回值类型可以从return中推断 1234const fn &#x3D; (name: str">
<meta property="og:type" content="article">
<meta property="og:title" content="Typescript&#x2F;类型变换">
<meta property="og:url" content="http://yoursite.com/2020/11/22/Typescript/%E7%B1%BB%E5%9E%8B%E5%8F%98%E6%8D%A2/index.html">
<meta property="og:site_name" content="Typescript">
<meta property="og:description" content="类型变换 类型推断 Tyepscript可以根据一些简单的规则推断变量的类型  从右到左  变量的类型可以从定义中推断  123&#x2F;&#x2F; 即使不写类型，也会自动推导出来let name &#x3D; &#39;hchlq&#39;;  &#x2F;&#x2F; name是string类型let age &#x3D; 18; &#x2F;&#x2F; age是number类型  从底部流出  返回值类型可以从return中推断 1234const fn &#x3D; (name: str">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2020-11-22T04:58:04.467Z">
<meta property="article:modified_time" content="2020-11-22T13:13:21.289Z">
<meta property="article:author" content="HC">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://yoursite.com/2020/11/22/Typescript/%E7%B1%BB%E5%9E%8B%E5%8F%98%E6%8D%A2/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'en'
  };
</script>

  <title>Typescript/类型变换 | Typescript</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <div>
      <a href="/Typescript/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Typescript</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/Typescript/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/Typescript/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="en">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2020/11/22/Typescript/%E7%B1%BB%E5%9E%8B%E5%8F%98%E6%8D%A2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/Typescript/images/avatar.gif">
      <meta itemprop="name" content="HC">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Typescript">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Typescript/类型变换
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-11-22 12:58:04 / Modified: 21:13:21" itemprop="dateCreated datePublished" datetime="2020-11-22T12:58:04+08:00">2020-11-22</time>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="类型变换"><a href="#类型变换" class="headerlink" title="类型变换"></a>类型变换</h1><ul>
<li><p>类型推断</p>
<p>Tyepscript可以根据一些简单的规则推断变量的类型</p>
<ul>
<li><p>从右到左</p>
<ul>
<li>变量的类型可以从定义中推断</li>
</ul>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 即使不写类型，也会自动推导出来</span></span><br><span class="line"><span class="keyword">let</span> name = <span class="string">'hchlq'</span>;  <span class="comment">// name是string类型</span></span><br><span class="line"><span class="keyword">let</span> age = <span class="number">18</span>; <span class="comment">// age是number类型</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>从底部流出</p>
<ul>
<li><p>返回值类型可以从return中推断</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> fn = <span class="function">(<span class="params">name: <span class="built_in">string</span>, age: <span class="built_in">number</span></span>) =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="string">'hchlq'</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 自动的从return中推断出fn的类型是 const fn: (name: string, age: number) =&gt; string</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>从左到右</p>
<ul>
<li>函数的参数和返回值类型也可以通过赋值的类型推断</li>
</ul>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IFn &#123;</span><br><span class="line">    (name: <span class="built_in">string</span>, age: <span class="built_in">number</span>): <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">let</span> fn2: IFn = <span class="function">(<span class="params">name, age</span>) =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="string">'hchlq'</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>对象内属性的自动推导</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> obj = &#123;</span><br><span class="line">  name: <span class="string">'hchlq'</span>,</span><br><span class="line">  age: <span class="number">18</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 推导成下面的类型</span></span><br><span class="line"><span class="keyword">const</span> obj: &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>交叉类型</p>
<ul>
<li><p>交叉类型是将多个类型合并成一个类型</p>
</li>
<li><p>这让我们可以把现有的多种类型跌跤到一起成为一种类型，它包含了所需的所有类型的特性</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> A &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> B &#123;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> C = A &amp; B;</span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> obj: C = &#123;</span><br><span class="line">    name: <span class="string">'hchlq'</span>,</span><br><span class="line">    age: <span class="number">18</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// obj需要同时满足A 和 B的接口</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>联合类型的交叉类型</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> a = <span class="built_in">number</span> | <span class="built_in">string</span>;</span><br><span class="line"><span class="keyword">type</span> b = <span class="built_in">number</span> | <span class="built_in">boolean</span>;</span><br><span class="line"><span class="keyword">type</span> c = a &amp; b;</span><br><span class="line"><span class="comment">// 得到的c 类型是number, 也就是说，联合类型的交叉类型是取他们的交集</span></span><br><span class="line"><span class="comment">// c 要同时满足a 和 b</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// --------------------- mixin</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">mixin</span>&lt;<span class="title">T</span> <span class="title">extends</span> <span class="title">Obj</span>, <span class="title">K</span> <span class="title">extends</span> <span class="title">Obj</span>&gt;(<span class="params">obj1: T, obj2: K</span>): <span class="title">T</span> &amp; <span class="title">K</span> </span>&#123;</span><br><span class="line">    <span class="keyword">let</span> obj = &lt;T &amp; K&gt;&#123;&#125;;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">let</span> prop1 <span class="keyword">in</span> obj1) &#123;</span><br><span class="line">        (&lt;T&gt;obj)[prop1] = obj1[prop1];</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">let</span> prop2 <span class="keyword">in</span> obj2) &#123;</span><br><span class="line">        (&lt;K&gt;obj)[prop2] = obj2[prop2];</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> obj;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> obj1 = &#123;</span><br><span class="line">    name: <span class="string">'hchlq'</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> obj2 = &#123;</span><br><span class="line">    age: <span class="number">18</span></span><br><span class="line">&#125;</span><br><span class="line">mixin(obj1, obj2);</span><br></pre></td></tr></table></figure>
</li>
<li><p>typeof </p>
<ul>
<li><p><code>typeof 变量</code>在ts中是获取到这个变量 的类型</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> obj = &#123;</span><br><span class="line">    name: <span class="string">'hchlq'</span>,</span><br><span class="line">    age: <span class="number">18</span>,</span><br><span class="line">    sex: <span class="string">'male'</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Temp = <span class="keyword">typeof</span> obj;</span><br><span class="line"><span class="comment">// 得到的类型是</span></span><br><span class="line"><span class="keyword">type</span> Temp = &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    sex: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>keyof </p>
<ul>
<li><p>索引类型操作符</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> Person &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    sex: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> person = keyof Person;</span><br><span class="line"><span class="comment">// 得到的类型是</span></span><br><span class="line"><span class="comment">// type person = "name" | "age" | "sex"</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>映射类型 <code>in</code></p>
<ul>
<li><p>在定义的时候用in操作符取批量定义类型中的属性</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> Person &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    sex: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Person2 =  &#123;</span><br><span class="line">    [key <span class="keyword">in</span> keyof Person]: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 注意的是，不能在接口中使用in操作符</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>条件类型</p>
<p>在定义泛型的时候添加逻辑分支，使泛型更加灵活</p>
<ul>
<li><p>定义条件类型</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> Animal &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> Person &#123;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    eat():<span class="built_in">void</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// extends关键字就是T需要满足的类型</span></span><br><span class="line"><span class="comment">// 这里的意思是，如果T 满足 Person, 就返回Person类型，否则返回Animal</span></span><br><span class="line"><span class="keyword">type</span> Type&lt;T&gt; = T <span class="keyword">extends</span> Person ? Person : Animal;</span><br><span class="line"><span class="keyword">let</span> obj: Type&lt;Person&gt; = &#123;</span><br><span class="line">    age: <span class="number">18</span>,</span><br><span class="line">    eat() &#123;&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>条件类型的分发</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> a = <span class="built_in">number</span> | <span class="built_in">string</span> | <span class="built_in">boolean</span>;</span><br><span class="line"><span class="keyword">type</span> b = <span class="built_in">string</span>;</span><br><span class="line"><span class="comment">// 用联合类型T去看是否满足K类型，满足返回T, 否则返回never;</span></span><br><span class="line"><span class="comment">// 1 number extends string ? number : never </span></span><br><span class="line"><span class="comment">// 2 string extends string ? string : never</span></span><br><span class="line"><span class="comment">// 3 boolean extends string ? boolean : never</span></span><br><span class="line"><span class="comment">// 最终结果   never | string | never  =&gt; string  </span></span><br><span class="line"><span class="comment">// never与其他类型联合得到的其他类型</span></span><br><span class="line"><span class="keyword">type</span> c&lt;T, K&gt; = T <span class="keyword">extends</span> K ? T : never;</span><br><span class="line"><span class="keyword">let</span> t:c&lt;a, b&gt; = <span class="string">'hchlq'</span>;</span><br></pre></td></tr></table></figure>
</li>
<li><p>内置条件类型</p>
<ul>
<li><p>Exclude</p>
<p>表示从一组联合类型中排除掉特定的一个</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> Exclude&lt;T, K&gt; = T <span class="keyword">extends</span> K ? never : K;</span><br><span class="line"><span class="keyword">type</span> MyExclude = Exclude&lt;<span class="built_in">string</span> | <span class="built_in">number</span>, <span class="built_in">number</span> &gt;;</span><br><span class="line"><span class="comment">// 表示从string | number 中排除掉number</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>Extract</p>
<p>从一组联合类型中选出特定的一个</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> Extract&lt;T, K&gt; = T <span class="keyword">extends</span> K ? T : never;</span><br><span class="line"><span class="keyword">type</span> MyExtract = Extract&lt;<span class="built_in">string</span> | <span class="built_in">number</span>, <span class="built_in">string</span>&gt;;</span><br><span class="line"><span class="comment">// 表示从string | number中选出string</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>NonNullable</p>
<ul>
<li><p>从T中排除掉null和undefined</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> NonNullable&lt;T&gt; = T <span class="keyword">extends</span> (<span class="literal">null</span> | <span class="literal">undefined</span>) ? never : T; </span><br><span class="line"><span class="keyword">type</span> MyNonNullable = NonNullable&lt;<span class="built_in">string</span> | <span class="built_in">number</span> | <span class="literal">null</span> | <span class="literal">undefined</span>&gt;;</span><br><span class="line"><span class="comment">// 从 string number null undefined中排除掉null 和 undefined</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>ReturnType</p>
<ul>
<li><p>获取函数类型的返回值类型</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> Fn = <span class="function">(<span class="params">name: <span class="built_in">string</span>, age: <span class="built_in">number</span></span>) =&gt;</span> <span class="built_in">void</span>; </span><br><span class="line"><span class="keyword">type</span> ReturnType&lt;T <span class="keyword">extends</span> (...args: <span class="built_in">any</span>) =&gt; <span class="built_in">any</span>&gt; = T <span class="keyword">extends</span> (...args: <span class="built_in">any</span>) =&gt; infer K ? K : <span class="built_in">any</span>;</span><br><span class="line"><span class="keyword">type</span> MyRetureType = ReturnType&lt;Fn&gt;;</span><br><span class="line"><span class="comment">// infer是关键字，表示在extends条件语句中待推断的类型变量，如果有的话，就返回回去，否则返回never</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>Parameters</p>
<ul>
<li><p>获取函数的参数类型</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> Fn2 = <span class="function">(<span class="params">name: <span class="built_in">string</span>, age: <span class="built_in">number</span></span>) =&gt;</span> <span class="built_in">void</span>; </span><br><span class="line"><span class="keyword">type</span> Parameters&lt;T <span class="keyword">extends</span> (...args: <span class="built_in">any</span>) =&gt; <span class="built_in">any</span>&gt; = T <span class="keyword">extends</span> (...args: infer K) =&gt; <span class="built_in">any</span> ? K: never;</span><br><span class="line"><span class="keyword">type</span> MyParameters = Parameters&lt;Fn2&gt;;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>InstanceType</p>
<p>获取构造函数类型的实例</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">class</span> Animal &#123;</span><br><span class="line">    <span class="keyword">public</span> name: <span class="built_in">string</span> = <span class="string">'hchlq'</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> InstanceType&lt;T <span class="keyword">extends</span> <span class="keyword">new</span> (...args: <span class="built_in">any</span>) =&gt; <span class="built_in">any</span>&gt; = T <span class="keyword">extends</span> <span class="keyword">new</span> (...args: <span class="built_in">any</span>) =&gt; infer K ? K : <span class="built_in">any</span>;</span><br><span class="line"><span class="keyword">type</span> MyInstanceType = InstanceType&lt;<span class="keyword">typeof</span> Animal&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>元组类型转为联合类型</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> Transfer&lt;T&gt; = T <span class="keyword">extends</span> <span class="built_in">Array</span>&lt;infer E&gt; ? E : never;</span><br><span class="line"><span class="keyword">type</span> Arr = Transfer&lt;[<span class="built_in">number</span>, <span class="built_in">string</span>, <span class="built_in">boolean</span>]&gt;;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>内置工具类型</p>
<ul>
<li><p>一个 <code>readonly</code> 或 <code>?</code>修饰符在 <code>-</code>或<code>+</code>下可以表示减少或增加</p>
</li>
<li><p>Partial  </p>
<p>表示可以将必选改成必选</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    sex: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Partial&lt;T <span class="keyword">extends</span> object&gt; = &#123;</span><br><span class="line">    [K <span class="keyword">in</span> keyof T]?: T[K]</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Person = Partial&lt;IPerson&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>DeepPartial</p>
<p>深度变成可选的</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    msg: IMsg;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> DeepPartial&lt;T <span class="keyword">extends</span> object&gt; = &#123;</span><br><span class="line">    [K <span class="keyword">in</span> keyof T]?: T[K] <span class="keyword">extends</span> object ? DeepPartial&lt;T[K]&gt; : T[K];</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Person = DeepPartial&lt;IPerson&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Required</p>
<p>必填</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Required&lt;T <span class="keyword">extends</span> object&gt; = &#123;</span><br><span class="line">    [K <span class="keyword">in</span> keyof T]-?: T[K];</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> MyRequired = Required&lt;IPerson&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Readonly</p>
<p>只读属性</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Readonly&lt;T <span class="keyword">extends</span> object&gt; = &#123;</span><br><span class="line">    readonly [K <span class="keyword">in</span> keyof T]: T[K];</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> MyReadOnly = Readonly&lt;IPerson&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Pick</p>
<p>从对象接口中选取特定的一个属性， 也称精挑细选</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Pick&lt;T, K <span class="keyword">extends</span> keyof T&gt; = &#123;</span><br><span class="line">    <span class="comment">// U in K 表示遍历 K, U作为属性</span></span><br><span class="line">    [U <span class="keyword">in</span> K]: T[U]</span><br><span class="line">&#125; </span><br><span class="line"><span class="keyword">type</span> MyPick = Pick&lt;IPerson, <span class="string">'name'</span>&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Record</p>
<p>描述一个对象的key 和value</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Record&lt;T <span class="keyword">extends</span> keyof <span class="built_in">any</span>, K&gt; = &#123;</span><br><span class="line">    [U <span class="keyword">in</span> T]: K</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> MyRecord = Record&lt;<span class="built_in">string</span>, <span class="built_in">number</span> | <span class="built_in">boolean</span>&gt;;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>自定义高级类型</p>
<ul>
<li><p>Proxy</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> Proxy&lt;T&gt; = &#123;</span><br><span class="line">    <span class="keyword">get</span>(): T;</span><br><span class="line">    <span class="keyword">set</span>(value: T): <span class="built_in">any</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>SetDifference&lt;T, K&gt;</p>
<p>两个联合类型中不一样的部分</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> SetDifference&lt;T, K&gt; = T <span class="keyword">extends</span> K ? never : T;</span><br><span class="line"><span class="keyword">type</span> MySetDifference = SetDifference&lt;<span class="built_in">string</span> | <span class="built_in">number</span> | <span class="built_in">boolean</span>, <span class="built_in">string</span>&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Omit &lt;T, K&gt;</p>
<p>忽略掉对象的某个属性</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Omit&lt;T, K <span class="keyword">extends</span> keyof <span class="built_in">any</span>&gt; = Pick&lt;T, Exclude&lt;keyof T, K&gt;&gt;;</span><br><span class="line"><span class="keyword">type</span> MyOmit = Omit&lt;IPerson, <span class="string">'name'</span>&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Diff </p>
<p>得到两个类型对象中不同的部分， 有优先级，谁在前就以谁为标准去比较</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> IPerson2 &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 以 IPerson为准，筛选掉IPerson有， IPerson2中没有的部分，两个都有的去掉</span></span><br><span class="line"><span class="keyword">type</span> Diff&lt;T, K&gt; = Pick&lt;T, Exclude&lt;keyof T, keyof K&gt;&gt;;</span><br><span class="line"><span class="keyword">type</span> MyDiff = Diff&lt;IPerson, IPerson2&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Intersection</p>
<p>两个类型对象的交集</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> IPerson2 &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> intersection&lt;T <span class="keyword">extends</span> object, K <span class="keyword">extends</span> object&gt; = Pick&lt;T, Extract&lt;keyof T, keyof K&gt;&gt;;</span><br><span class="line"><span class="keyword">type</span> MyInterction = intersection&lt;IPerson, IPerson2&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Overwirite</p>
<p>覆盖</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> IPerson2 &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">boolean</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Computed&lt;T <span class="keyword">extends</span> object&gt; = &#123;</span><br><span class="line">    [K <span class="keyword">in</span> keyof T]: T[K]</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Overwrite&lt;T <span class="keyword">extends</span> object, K <span class="keyword">extends</span> object&gt; = T &amp; Omit&lt;K, keyof T&gt;;</span><br><span class="line"><span class="keyword">type</span> MyOverWrite = Computed&lt;Overwrite&lt;IPerson2, IPerson&gt;&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Merge</p>
<p>合并</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    address: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> IPerson2 &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">boolean</span>;</span><br><span class="line">    sex: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> intersection&lt;T <span class="keyword">extends</span> object, K <span class="keyword">extends</span> object&gt; = Pick&lt;T, Extract&lt;keyof T, keyof K&gt;&gt;;</span><br><span class="line"><span class="keyword">type</span> Computed&lt;T <span class="keyword">extends</span> object&gt; = &#123;</span><br><span class="line">    [K <span class="keyword">in</span> keyof T]: T[K]</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Merge&lt;T <span class="keyword">extends</span> object, K <span class="keyword">extends</span> object&gt; = K &amp; Omit&lt;T, keyof intersection&lt;T, K&gt;&gt;;</span><br><span class="line"><span class="comment">// 用IPerson2去合并IPerson</span></span><br><span class="line"><span class="keyword">type</span> MyMerge = Computed&lt;Merge&lt;IPerson, IPerson2&gt;&gt;;</span><br></pre></td></tr></table></figure>
</li>
<li><p>Mutable</p>
<p>将只读属性的readonly去掉</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson2 &#123;</span><br><span class="line">    readonly name: <span class="built_in">string</span>;</span><br><span class="line">    readonly age: <span class="built_in">boolean</span>;</span><br><span class="line">    sex: <span class="built_in">string</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> Mutable&lt;T <span class="keyword">extends</span> object&gt; = &#123;</span><br><span class="line">    -readonly [K <span class="keyword">in</span> keyof T]: T[K]</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> MyMutable = Mutable&lt;IPerson2&gt;</span><br></pre></td></tr></table></figure>





</li>
</ul>
</li>
</ul>
</li>
</ul>

    </div>

    
    
    

      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/Typescript/2020/11/21/Typescript/%E7%B1%BB%E5%9E%8B%E4%BF%9D%E6%8A%A4/" rel="prev" title="Typescript/类型保护">
      <i class="fa fa-chevron-left"></i> Typescript/类型保护
    </a></div>
      <div class="post-nav-item">
    <a href="/Typescript/2020/11/23/Typescript/%E6%A8%A1%E5%9D%97%E5%92%8C%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4/" rel="next" title="Typescript/模块和命名空间">
      Typescript/模块和命名空间 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#类型变换"><span class="nav-number">1.</span> <span class="nav-text">类型变换</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">HC</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/Typescript/archives/">
        
          <span class="site-state-item-count">12</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">HC</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> v4.2.1
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">Theme – <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> v7.7.2
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/Typescript/lib/anime.min.js"></script>
  <script src="/Typescript/lib/velocity/velocity.min.js"></script>
  <script src="/Typescript/lib/velocity/velocity.ui.min.js"></script>

<script src="/Typescript/js/utils.js"></script>

<script src="/Typescript/js/motion.js"></script>


<script src="/Typescript/js/schemes/muse.js"></script>


<script src="/Typescript/js/next-boot.js"></script>




  















  

  

</body>
</html>
